package com.jiedeng.dao;

import com.jiedeng.model.SysRule;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author 覃远龙
 * @ClassName: ISysRuleRepository
 * @Description:
 * @date 2017/12/12 14:31
 */
public interface ISysRuleRepository extends JpaRepository<SysRule, Long>
{
    @Query(nativeQuery = true, value = " select sr.* from sys_module sm LEFT JOIN sys_rule sr on sr.Module_Id = sm.id " +
            " where sm.Byname = ?1 and sr.Post_ID = ?2 and sr.type = 'C' and (sr.Corp_ID = -1 or sr.Corp_ID = ?3)")
    List<SysRule> checkRule(String byname,Long postId,Long corpId);
}
